package com.lee.enjoy04_221113

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.widget.Button
import android.widget.TextView
import com.lee.enjoy04_221113.anno.Inject
import java.lang.reflect.InvocationHandler
import java.lang.reflect.Proxy

class MainEnjoy01Activity : AppCompatActivity() {
    private val handler = Handler()
    @Inject(R.id.tv_hello)
    var textView:TextView? = null
    @Inject(R.id.btn_jump)
    var btn:Button? = null
    @Inject(R.id.btn_proxy)
    var btn_proxy:Button? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main_enjoy01)
        InjtectUtils.injectView(activity = this)

        btn?.setOnClickListener {
            val intent = Intent(it.context,SecondActivity::class.java)
            val bundle = Bundle();
            bundle.putString("name","lizhanwei")
            intent.putExtra("bundle",bundle);
            startActivity(intent)
        }
        handler.postDelayed({
                  textView?.text  = "变换字体"
        },5000)

        btn_proxy?.setOnClickListener {
            Proxy.newProxyInstance(this.classLoader,
                Class()[]{}, InvocationHandler { any, method, arrayOfAnys ->

            })
        }
    }
}